package cate.game.role.res.holy_pet.core;

import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 单个灵宠数据
 *
 * @author ShenSL
 * @since 2023/8/23 11:07
 */
@Data
@NoArgsConstructor
@NoteClass("单个灵宠数据")
public class SingleHolyPetPO {
    @NoteField("灵宠ID")
    private int petId;
    @NoteField("是否已激活")
    private boolean active;
    @NoteField("好感等级")
    private int favorLevel;
    @NoteField("好感经验")
    private long favorExp;
    @NoteField("亲密等级")
    private int closenessLevel;
    @NoteField("亲密经验")
    private long closenessExp;
    @NoteField("修炼等级")
    private int practiceLevel;

    public SingleHolyPetPO(int petId) {
        this.petId = petId;
        // 各等级默认为1级
        favorLevel = 1;
        closenessLevel = 1;
        practiceLevel = 1;
    }

    /**
     * 变更好感经验
     */
    public void changeFavorExp(long exp) {
        favorExp = Math.max(0, favorExp + exp);
    }

    /**
     * 变更亲密经验
     */
    public void changeClosenessExp(long exp) {
        closenessExp = Math.max(0, closenessExp + exp);
    }
}
